package cn.hl.basic.service.impl;

import cn.hl.basic.service.IBaiduAiAuditService;
import cn.hl.basic.util.BaiduAuditUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class BaiduAiAuditServiceImpl implements IBaiduAiAuditService {

    @Override
    public Boolean textAudit(String text) {
        Boolean boo = BaiduAuditUtils.TextCensor(text);
        return boo;
    }

    @Override
    public Boolean imageAudit(String resources) {
        Boolean result = true;
        if (!StringUtils.isEmpty(resources)) {
            String[] arr = resources.split(",");
            for (String i : arr) {
                String url = "http://123.207.27.208" + i;
                if (!BaiduAuditUtils.ImgCensor(url)) {
                    result = false;
                    break;
                }
            }
        }
        return result;
    }
}
